﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;

namespace YJKArch.AreaStatistical.Statistical
{
	public class TreeListViewEditor
	{
		public static TreeListViewItem AddRootItem(string name, int imageIndex, TreeListView parent)
		{
			TreeListViewItem treeListViewItem = new TreeListViewItem(name, imageIndex);
			treeListViewItem.Expand();
			parent.Items.Add(treeListViewItem);
			return treeListViewItem;
		}

		public static TreeListViewItem AddItem(string name, int imageIndex, TreeListViewItem parent)
		{
			TreeListViewItem treeListViewItem = new TreeListViewItem(name, imageIndex);
			treeListViewItem.Expand();
			parent.Items.Add(treeListViewItem);
			return treeListViewItem;
		}

		public static ListViewItem.ListViewSubItem AddColumnItem(string value, TreeListViewItem parent, System.Drawing.Color backColor)
		{
			ListViewItem.ListViewSubItem listViewSubItem = parent.SubItems.Add(value);
			listViewSubItem.BackColor = backColor;
			return listViewSubItem;
		}

		public static void AddColumnItems(List<string> values, int startIndex, TreeListViewItem parent, System.Drawing.Color backColor)
		{
			for (int i = startIndex; i < values.Count; i++)
			{
				TreeListViewEditor.AddColumnItem(values[i], parent, backColor);
			}
		}
	}
}
